package com.hrt.web.product.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hrt.bean.GiftInfor;
import com.hrt.web.product.dao.GiftInforDao;
import com.hrt.web.product.service.GiftInforService;

@Service
@Transactional
public class GiftInforServiceWebImpl implements GiftInforService {
	
	private GiftInforDao giftInforDao ;
	
	public GiftInforDao getGiftInforDao() {
		return giftInforDao;
	}
	@Resource
	public void setGiftInforDao(GiftInforDao giftInforDao) {
		this.giftInforDao = giftInforDao;
	}
	
	/**
	 * 前台的礼品展示列表
	 * */
	@Override
	public List<GiftInfor> searchofeight() {
		
		return this.giftInforDao.findofeight();
	}
	
	/**分页*/
	@Override
	public Long totalCount() {
		return this.giftInforDao.totalCount();
	}

	@Override
	public List<GiftInfor> queryByPage(int pageIndex, int pageSize) {
		return this.giftInforDao.queryByPage(pageIndex, pageSize);
	}

	/**
	 * 按id查询实体
	 * */
	@Override
	public GiftInfor getById(Long id) {
		return this.giftInforDao.getById(id);
	}
	
	/**父级下的分页*/
	@Override
	public List<GiftInfor> queryById(String gdId, Integer pageIndex,
			Integer pageSize) {
		List<Map<String, Object>> conditions=new ArrayList<Map<String, Object>>();
		List<GiftInfor> list=new ArrayList<GiftInfor>();
		Map<String, Object> con=new HashMap<String, Object>();
		con.put("field", "id");
		con.put("value", gdId);
		
		Map<String, Object> delcon=new HashMap<String, Object>();
		delcon.put("field", "isdelete");
		delcon.put("value", 0);
		conditions.add(con);
		list=giftInforDao.queryPageByGiftId(conditions,pageIndex, pageSize);
		
		return list;
	}

}
